/*
 * Created on 2005-4-12
 *
 * Window - Preferences - Java - Code Style - Code Templates
 */
package im;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.StringTokenizer;

import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

import com.jasson.im.api.APIClient;
import com.jasson.im.api.MOItem;
import com.jasson.im.api.RPTItem;


public class DemoFrame extends javax.swing.JFrame
{

    APIClient apiClient = null;
    private int smType = 0;

    /**
     * Creates new form NewJFrame
     */
    public DemoFrame()
    {
        initComponents();
        apiClient = new APIClient();
    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents()
    {
        this.setTitle("API Demo - Java");
        jPanel1 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jtextIP = new javax.swing.JTextField();
        jtextDBUser = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jtextApiID = new javax.swing.JTextField();
        jtextSrcID = new javax.swing.JTextField();
        jtextSendTime = new javax.swing.JTextField();
        jtextDBName = new javax.swing.JTextField();
        jpasswordDBPwd = new javax.swing.JPasswordField();
        jPanel2 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jScrollPane1.setBounds(new Rectangle(111, 7, 150, 62));
        jScrollPane1.setPreferredSize(new Dimension(145, 23));
        jScrollPane1.setFont(new java.awt.Font("DialogInput", 0, 12));
        jScrollPane2 = new javax.swing.JScrollPane();
        jScrollPane2.setBounds(new Rectangle(111, 7, 150, 62));
        jScrollPane2.setPreferredSize(new Dimension(145, 23));
        jScrollPane2.setFont(new java.awt.Font("DialogInput", 0, 12));
        jtextMobile = new javax.swing.JTextArea("13516871762");
        jtextContent = new javax.swing.JTextArea("使用Java API发送短信！");
        jPanel9 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanelDBConn = new javax.swing.JPanel();
        jBtnInit = new javax.swing.JButton();
        jBtnRelease = new javax.swing.JButton();
        jBtnSend = new javax.swing.JButton();
        jBtnRecvSM = new javax.swing.JButton();
        jBtnRecvRPT = new javax.swing.JButton();
        jBtnExit = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);
        jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 65, 5));

        jPanel1.setBorder(new javax.swing.border.TitledBorder("数据库连接信息"));
        jPanel1.setPreferredSize(new java.awt.Dimension(400, 100));
        jPanel11.setPreferredSize(new java.awt.Dimension(380, 90));
        jPanel11.setLayout(new java.awt.GridLayout(3, 4, 0, 2));

        jPanel11.setMinimumSize(new java.awt.Dimension(50, 38));

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("IP地址：");
        jLabel1.setPreferredSize(new java.awt.Dimension(56, 24));
        jPanel11.add(jLabel1);
        jtextIP.setText("192.168.0.52");
        jPanel11.add(jtextIP);

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("用户名：");
        jLabel2.setPreferredSize(new java.awt.Dimension(40, 24));
        jPanel11.add(jLabel2);
        jtextDBUser.setFont(new java.awt.Font("Arial", 0, 12));
        jtextDBUser.setText("dbi");
        jPanel11.add(jtextDBUser);

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("api编码：");
        jLabel3.setPreferredSize(new java.awt.Dimension(56, 24));
        jPanel11.add(jLabel3);
        jtextApiID.setText("dbi");
        jtextApiID.setPreferredSize(new java.awt.Dimension(80, 24));
        jPanel11.add(jtextApiID);

        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("密码：");
        jLabel4.setPreferredSize(new java.awt.Dimension(40, 24));
        jLabel4.setRequestFocusEnabled(false);
        jPanel11.add(jLabel4);
        jpasswordDBPwd.setText("dbi");
        jpasswordDBPwd.setEchoChar('#');
        jPanel11.add(jpasswordDBPwd);

        jtextDBName.setText("mas");
        jtextDBName.setPreferredSize(new java.awt.Dimension(80, 24));
        jPanel11.add(new JLabel("数据库名："));
        jPanel11.add(jtextDBName);

        jPanel1.add(jPanel11);




        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        jPanel2.setLayout(new java.awt.BorderLayout());

        jPanel2.setPreferredSize(new java.awt.Dimension(500, 300));
        jPanel8.setPreferredSize(new java.awt.Dimension(500, 200));
        jPanel6.setLayout(new java.awt.GridLayout(2, 2, 5, 10));

        jPanel6.setPreferredSize(new java.awt.Dimension(100, 110));
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText("手机号码：");
//        jLabel5.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
        jPanel6.add(jLabel5);

        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText("短信内容：");
//        jLabel6.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
        jPanel6.add(jLabel6);



        jPanel8.add(jPanel6);

        jPanel7.setLayout(new java.awt.GridLayout(2, 1, 0, 10));

        jPanel7.setPreferredSize(new java.awt.Dimension(300, 110));
        jtextMobile.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
        jtextMobile.setPreferredSize(new java.awt.Dimension(1000, 1000));
        jtextMobile.setLineWrap(true);
        jScrollPane1.getViewport().add(jtextMobile, null);
        jPanel7.add(jScrollPane1, null);

        jtextContent.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
        jtextContent.setPreferredSize(new java.awt.Dimension(1000, 1000));
        jtextContent.setLineWrap(true);
        jScrollPane2.getViewport().add(jtextContent, null);

        jPanel7.add(jScrollPane2, null);



        jPanel8.add(jPanel7);

        javax.swing.JPanel jPanelT = new javax.swing.JPanel(new BorderLayout());
        jPanelT.add(jPanel8,java.awt.BorderLayout.CENTER);

        javax.swing.JPanel jPanel = new javax.swing.JPanel(new java.awt.GridLayout(2, 3, 35, 2));
                 jPanel.add(new javax.swing.JLabel("手机上显示尾码srcID:",javax.swing.SwingConstants.RIGHT));

                 jtextSrcID.setText("10");
                 jPanel.add(jtextSrcID);
                 javax.swing.JLabel jlabelNumFormat = new javax.swing.JLabel("*正整数",javax.swing.SwingConstants.LEFT);
                 jlabelNumFormat.setForeground(Color.RED);
                 jPanel.add(jlabelNumFormat);
                 jPanel.add(new javax.swing.JLabel("发送时间:",javax.swing.SwingConstants.RIGHT));
                 jtextSendTime.setText(getCurDateTime());
                 jPanel.add(jtextSendTime);
                 javax.swing.JLabel jlabelTimeFormat = new javax.swing.JLabel("*yyyy-MM-dd hh:mm:ss",javax.swing.SwingConstants.LEFT);
                 jlabelTimeFormat.setForeground(Color.RED);
                 jPanel.add(jlabelTimeFormat);
                 jPanelT.add(jPanel,BorderLayout.SOUTH);

        jPanel2.add(jPanelT, java.awt.BorderLayout.CENTER);

        jPanel9.setPreferredSize(new java.awt.Dimension(10, 20));
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel8.setText("Java API DEMO");
        jLabel8.setPreferredSize(new java.awt.Dimension(415, 18));
        jPanel9.add(jLabel8);

        jPanel2.add(jPanel9, java.awt.BorderLayout.NORTH);
                {
                        jPanel10 = new javax.swing.JPanel();
                        jPanel2.add(jPanel10, BorderLayout.SOUTH);
                        jPanel10.setLayout(null);
                        //jPanel10.setBounds(66, 255, 142, 90);
                        jPanel10.setPreferredSize(new java.awt.Dimension(500, 120));
                        {
                                jPanel15 = new JPanel();
                                jPanel10.add(jPanel15);


                                BorderLayout jPanel15Layout = new BorderLayout();
                                jPanel15.setBounds(66, 5, 142, 120);
                                jPanel15.setPreferredSize(new java.awt.Dimension(52, 120));
                                jPanel15.setLayout(jPanel15Layout);
                                {
                                        jLabelUrl = new JLabel();
                                        jPanel15.add(jLabelUrl, BorderLayout.SOUTH);
                                        jLabelUrl.setText("Wap Push短信的URL：");
                                        jLabelUrl.setHorizontalAlignment(SwingConstants.RIGHT);
                                        //jPanel15.setBounds(96, 35, 142, 90);
                                        jLabelUrl.setPreferredSize(new java.awt.Dimension(52, 30));
                                        //jLabelUrl.setBounds(5, 36, 52, 24);
                                }



                                {
                                        jLabel7 = new javax.swing.JLabel();
                                        jPanel15.add(jLabel7, BorderLayout.NORTH);
                                        jLabel7.setHorizontalAlignment(SwingConstants.RIGHT);
                                        jLabel7.setText("短信smID：");
                                        jLabel7.setPreferredSize(new java.awt.Dimension(52, 35));
                                }
                                {
                                        jLabelSmType = new JLabel();
                                        jPanel15.add(jLabelSmType, BorderLayout.CENTER);
                                        jLabelSmType.setText("短信类型：");
                                        jLabelSmType.setHorizontalAlignment(SwingConstants.RIGHT);
                                }
                        }
                        {
                                jPanel16 = new JPanel();
                                jPanel10.add(jPanel16);
                                jPanel16.setPreferredSize(new java.awt.Dimension(230, 90));
                                jPanel16.setLayout(null);
                                jPanel16.setBounds(220, 5, 500, 120);
                                {
                                        jPanelSmType = new JPanel();
                                        jPanel16.add(jPanelSmType);
                                        buttonGroupSmType = new ButtonGroup();
                                        jPanelSmType.setPreferredSize(new java.awt.Dimension(
                                                503,
                                                30));
                                        jPanelSmType.setBounds(5, 30, 500, 60);
                                        {
                                                jRadioButtonNormal = new JRadioButton("常规短信", true);
                                                jPanelSmType.add(jRadioButtonNormal);
                                                jRadioButtonNormal
                                                        .setPreferredSize(new java.awt.Dimension(77, 24));
                                        }
                                        {
                                                jRadioButtonWapPush = new JRadioButton(
                                                        "Wap Push短信",
                                                        false);
                                                jPanelSmType.add(jRadioButtonWapPush);
                                                jRadioButtonWapPush
                                                        .setPreferredSize(new java.awt.Dimension(380, 24));
                                        }
                                        {
                                                jRadioButtonPDU = new JRadioButton(
                                                        "PDU短信:(发送只填写数据库连接信息,其它参数由后台模拟)",
                                                        false);
                                                jPanelSmType.add(jRadioButtonPDU);
                                                jRadioButtonPDU
                                                        .setPreferredSize(new java.awt.Dimension(457, 24));
                                        }
                                        buttonGroupSmType.add(jRadioButtonNormal);
                                        jRadioButtonNormal.addActionListener(new ActionListener() {
                                                public void actionPerformed(ActionEvent evt) {
                                                        jTextFieldUrl.setEnabled(false);
                                                        smType = 0;
                                                }
                                        });
                                        buttonGroupSmType.add(jRadioButtonWapPush);
                                        jRadioButtonWapPush.addActionListener(new ActionListener() {
                                                public void actionPerformed(ActionEvent evt) {
                                                        jTextFieldUrl.setEnabled(true);
                                                        smType = 1;
                                                }
                                        });
                                        buttonGroupSmType.add(jRadioButtonPDU);
                                        jRadioButtonPDU.addActionListener(new ActionListener() {
                                                public void actionPerformed(ActionEvent evt) {
                                                        jTextFieldUrl.setEnabled(false);
                                                        smType = 2;
                                                }
                                        });
                                }
//				{
//					jTextFieldUrl = new JTextField();
//					jPanel16.add(jTextFieldUrl);
//					jTextFieldUrl.setEnabled(false);
//					jTextFieldUrl.setText("");
//					jTextFieldUrl.setPreferredSize(new java.awt.Dimension(
//						203,
//						30));
//					jTextFieldUrl.setBounds(5, 96, 282, 24);
//				}
                                {
                                        jTextFieldUrl = new JTextField();
                                        jPanel16.add(jTextFieldUrl);
                                        jTextFieldUrl.setEnabled(false);
                                        jTextFieldUrl.setText("");
                                        jTextFieldUrl.setPreferredSize(new java.awt.Dimension(
                                                203,
                                                30));
                                        jTextFieldUrl.setBounds(5, 96, 282, 24);
                                }
                                {
                                        jtextSmID = new javax.swing.JTextField();
                                        jPanel16.add(jtextSmID);
                                        jtextSmID
                                                .setHorizontalAlignment(javax.swing.JTextField.LEFT);
                                        jtextSmID.setText("10");
                                        jtextSmID
                                                .setPreferredSize(new java.awt.Dimension(203, 24));
                                        jtextSmID.setBounds(5, 0, 282, 24);
                                }
                        }

                }

        getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH);

        jPanel3.setLayout(new java.awt.BorderLayout());

        jPanel3.setPreferredSize(new java.awt.Dimension(150, 60));
        jBtnInit.setText("Init");
        jPanelDBConn.add(jBtnInit);

        jBtnRelease.setText("Release");
        jPanelDBConn.add(jBtnRelease);

        jBtnSend.setText("Send");
        jPanelDBConn.add(jBtnSend);

        jBtnRecvSM.setText("ReceiveSM");
        jPanelDBConn.add(jBtnRecvSM);

        jBtnRecvRPT.setText("ReceiveRPT");
        jPanelDBConn.add(jBtnRecvRPT);

        jBtnExit.setText("Exit");
        jPanelDBConn.add(jBtnExit);

        jBtnInit.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jBtnInitActionPerformed(evt);
            }
        });
        jBtnRelease.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jBtnReleaseActionPerformed(evt);
            }
        });
        jBtnSend.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jBtnSendActionPerformed(evt);
            }
        });
        jBtnRecvSM.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jBtnRecvSMActionPerformed(evt);
            }
        });
        jBtnRecvRPT.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jBtnRecvRPTActionPerformed(evt);
            }
        });
        jBtnExit.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jBtnExitActionPerformed(evt);
            }
        });
        this.addWindowListener(new WindowListener()
        {
            public void windowActivated(WindowEvent arg0)
            {
            }

            public void windowClosed(WindowEvent arg0)
            {
            }

            public void windowClosing(WindowEvent arg0)
            {
                apiClient.release();
                System.exit(0);
            }

            public void windowDeactivated(WindowEvent arg0)
            {
            }

            public void windowDeiconified(WindowEvent arg0)
            {
            }

            public void windowIconified(WindowEvent arg0)
            {
            }

            public void windowOpened(WindowEvent arg0)
            {
            }
        });
        jPanel3.add(jPanelDBConn, java.awt.BorderLayout.CENTER);

        jPanel3.add(jPanel5, java.awt.BorderLayout.SOUTH);

        getContentPane().add(jPanel3, java.awt.BorderLayout.SOUTH);

        pack();
    }

    private void jBtnExitActionPerformed(java.awt.event.ActionEvent evt)
    {
        apiClient.release();
        System.exit(0);
    }

    private void jBtnRecvRPTActionPerformed(java.awt.event.ActionEvent evt)
    {
        RPTItem[] rpts = apiClient.receiveRPT();
        int len = 0, i = 0;
        StringBuffer sb = new StringBuffer("");
        if(rpts == null)
        {
            showMesage("未初始化或接收失败");
            return;
        }
        else if(rpts.length == 0)
        {
            showMesage("没有回执");
        }
        else
        {
            len = rpts.length;
            while(i < len)
            {
                sb.append("手机: ");
                sb.append(rpts[i].getMobile() + " ");
                sb.append("回执编码: ");
                sb.append(rpts[i].getCode() + " ");
                sb.append("短信编号: ");
                sb.append(rpts[i].getSmID() + " ");
                sb.append("回执描述: ");
                sb.append(rpts[i].getDesc() + " ");
                sb.append("回执时间: ");
                sb.append(rpts[i].getRptTime() + " ");
                sb.append("\n");
                i++;
            }

            showMesage(sb.toString());
        }
    }



    private void jBtnRecvSMActionPerformed(java.awt.event.ActionEvent evt)
    {
        MOItem[] mos = apiClient.receiveSM();
        int len = 0, i = 0;
        StringBuffer sb = new StringBuffer("");
        if(mos == null)
        {
            showMesage("未初始化或接收失败");
            return;
        }
        else if(mos.length == 0)
        {
            showMesage("没有MO短信");
        }
        else
        {
            len = mos.length;
            while(i < len)
            {
                sb.append("手机号码: ");
                sb.append(mos[i].getMobile() + " ");
                sb.append("短信内容: ");
                sb.append(mos[i].getContent() + " ");
                sb.append("短信ID: "+mos[i].getSmID());
                sb.append(" MO时间: "+mos[i].getMoTime());
                sb.append(" msg编码: "+mos[i].getMsgFmt());
                sb.append("\n");
                i++;
            }

            showMesage(sb.toString());
        }
    }



    /**
     * @param evt
     */
    private void jBtnSendActionPerformed(java.awt.event.ActionEvent evt)
    {
        String mobileStr = jtextMobile.getText().trim();

        //改成支持JDK1.3
        ArrayList mobileList = new ArrayList();
        StringTokenizer st = new StringTokenizer(mobileStr, ",");
        while(st.hasMoreElements())
        {
                String tmp = (String)st.nextElement();
                mobileList.add(tmp);
        }

        String[] mobiles = new String[0];
        mobiles = (String[]) mobileList.toArray(mobiles);

        String sendTime = jtextSendTime.getText().trim();

        /*if(sendTime!=null&&sendTime.length()>1&&sendTime.compareTo(getCurDateTime())<0){
                showMesage("发送时间必须大于当前时间");
            return;
        }*/

        String content = jtextContent.getText();
        long smId = 0;
        long srcID = 0;
        try
        {
            smId = Long.parseLong(jtextSmID.getText());

        } catch(NumberFormatException e)
        {
            showMesage("短信ID只能为整数");
            return;
        }

        try
        {
            srcID = Long.parseLong(("".equals(jtextSrcID.getText().trim()))?jtextSmID.getText().trim():jtextSrcID.getText().trim());

        } catch(NumberFormatException e)
        {
            showMesage("SrcID只能为整数");
            return;
        }
        int result = 0;
        String url = "";
        if(smType == 1)
        {
                url = this.jTextFieldUrl.getText();
                if(url == null || url.trim().length() == 0)
                {
                        showMesage("请输入Wap Push的链接地址！");
                        return;
                }
                result = apiClient.sendSM(mobiles, content, smId, srcID, url, sendTime);
        }else if(smType == 2 ){
                        String[] moblieTest = {"13516870834","13516871762"};
                        //byte[] contentTest ={97,98,65,'B'};
                        byte[] contentTest="PDU短信测试内容！".getBytes();
                        result = apiClient.sendPDU(moblieTest, contentTest, smId, 0 , 0, 0, "", "", "", -1);
        }else
        {
                result = apiClient.sendSM(mobiles, content,sendTime, smId, srcID);
        }
        if(result == APIClient.IMAPI_SUCC)
        {
            showMesage("发送成功\n" );
        }
        else if(result == APIClient.IMAPI_INIT_ERR)
            showMesage("未初始化");
        else if(result == APIClient.IMAPI_CONN_ERR)
            showMesage("数据库连接失败");
        else if(result == APIClient.IMAPI_DATA_ERR)
            showMesage("参数错误");
        else if(result == APIClient.IMAPI_DATA_TOOLONG)
            showMesage("消息内容太长");
        else if(result == APIClient.IMAPI_INS_ERR)
            showMesage("数据库插入错误");
        else if(result == APIClient.IMAPI_IFSTATUS_INVALID)
                showMesage("接口处于暂停或失效状态");
        else if(result == APIClient.IMAPI_GATEWAY_CONN_ERR)
                showMesage("短信网关未连接");
        else
            showMesage("出现其他错误");

    }


    private void jBtnReleaseActionPerformed(java.awt.event.ActionEvent evt)
    {
        apiClient.release();
        showMesage("Release成功");
    }

    private void jBtnInitActionPerformed(java.awt.event.ActionEvent evt)
    {
        String ip = jtextIP.getText();
        String name = jtextDBUser.getText();
        String apiId = jtextApiID.getText();
        String pwd = new String(jpasswordDBPwd.getPassword());
        String dbName = jtextDBName.getText();

        int connectRe = apiClient.init(ip, name, pwd, apiId, dbName);
        if(connectRe == APIClient.IMAPI_SUCC)
            showMesage("初始化成功");
        else if(connectRe == APIClient.IMAPI_CONN_ERR)
            showMesage("连接失败");
        else if(connectRe == APIClient.IMAPI_API_ERR)
            showMesage("apiID不存在");
    }

    void showMesage(String message)
    {
        if(message == null)
        {
            message = "Default Message!";
        }
        JOptionPane.showMessageDialog(this, message, "Information",
            JOptionPane.INFORMATION_MESSAGE);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[])
    {
        java.awt.EventQueue.invokeLater(new Runnable()
        {
            public void run()
            {
                DemoFrame df = new DemoFrame();
                df.setSize(650, 540);
                df.setLocation(200, 100);
                df.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JButton jBtnInit;
    private javax.swing.JButton jBtnRelease;
    private javax.swing.JButton jBtnSend;
    private javax.swing.JButton jBtnRecvSM;
    private javax.swing.JButton jBtnRecvRPT;
    private javax.swing.JButton jBtnExit;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private JRadioButton jRadioButtonPDU;
    private JRadioButton jRadioButtonWapPush;
    private JRadioButton jRadioButtonNormal;
    private JPanel jPanelSmType;
    private ButtonGroup buttonGroupSmType;
    private JLabel jLabelSmType;
    private JTextField jTextFieldUrl;
    private JLabel jLabelUrl;
    private JPanel jPanel16;
    private JPanel jPanel15;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanelDBConn;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPasswordField jpasswordDBPwd;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jtextMobile;
    private javax.swing.JTextArea jtextContent;
    private javax.swing.JTextField jtextIP;
    private javax.swing.JTextField jtextDBUser;
    private javax.swing.JTextField jtextApiID;
    private javax.swing.JTextField jtextSrcID;
    private javax.swing.JTextField jtextSendTime;
    private javax.swing.JTextField jtextDBName;
    private javax.swing.JTextField jtextSmID;
    // End of variables declaration

    /**
     * 获得当前日期和时间
     *
     * @return String 当前日期和时间，格式：yyyy-MM-dd HH:mm:ss
     */
    public static String getCurDateTime()
    {
        SimpleDateFormat nowDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return nowDate.format(new Date());

    }

}

